﻿<UserControl x:Class="StockholmsStad.Windows.UI.Modules.Couple.Controls.CeremonyDetailsControl"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
    xmlns:converters="clr-namespace:StockholmsStad.Windows.UI.Infrastructure.Converters;assembly=StockholmsStad.Windows.UI.Infrastructure"
    xmlns:customControls="clr-namespace:StockholmsStad.Windows.UI.Infrastructure.Controls;assembly=StockholmsStad.Windows.UI.Infrastructure"
    mc:Ignorable="d">
    <UserControl.Resources>
        <converters:DateTimeToDateString x:Key="dateTimeConverter" />
    </UserControl.Resources>

    <Grid HorizontalAlignment="Stretch">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>

        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*" />
            <ColumnDefinition Width="*" /> <!--1*-->
        </Grid.ColumnDefinitions>

        <!--Hindersprövning-->
        <GroupBox Grid.Row="0" Grid.Column="0" Header="Hindersprövning" Margin="5,5,5,10" >

            <Grid Margin="0,10,0,0">
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="*" />
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto" />
                    <ColumnDefinition Width="Auto" />
                </Grid.ColumnDefinitions>

                <CheckBox x:Name="HPHasArrivedCheckBox" Padding="5,0,0,0" Content="Inkommit" 
                          Width="80" Margin="5,7,0,5" Grid.Row="0" Grid.ColumnSpan="2" 
                          IsChecked="{Binding HPHasArrived, UpdateSourceTrigger=Explicit}" HorizontalAlignment="Left" />
                <Label Content="Ansökan om HP tidigast:" Grid.Row="1" Grid.Column="0" />
                <Label Content="HP senast:" Grid.Row="2" Grid.Column="0" />
                
                <Label Content="HP utfärdandedatum:" Grid.Row="3" Grid.Column="0" />

                <TextBox x:Name="HPEarliestTextBox" Grid.Row="1" Grid.Column="1" IsEnabled="False" 
                         Text="{Binding HPEarliestDate, UpdateSourceTrigger=Explicit, Mode=TwoWay, Converter={StaticResource dateTimeConverter}}" />

                <Grid Grid.Row="2" Grid.Column="1">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="*"/>
                        <ColumnDefinition Width="Auto" />
                    </Grid.ColumnDefinitions>

                    <customControls:DateTimePicker Grid.Column="0" x:Name="HPLatestDateTextBox" Margin="0,2,0,0"
                                                   SelectedDate="{Binding HPLatestDate, UpdateSourceTrigger=Explicit, Mode=TwoWay}" />
                                                    
                </Grid>


                <Grid Grid.Row="3" Grid.Column="1">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="*"/>
                        <ColumnDefinition Width="Auto" />
                    </Grid.ColumnDefinitions>
                    
                    <customControls:DateTimePicker Grid.Column="0" x:Name="IssuedDateTextBox" Margin="0,2,0,0"
                                                   SelectedDate="{Binding HPIssuedDate, UpdateSourceTrigger=Explicit, Mode=TwoWay}" />

                </Grid>
                
            </Grid>

        </GroupBox>

        <!--Språk--> 
        <GroupBox Grid.Row="1" Grid.Column="0" Header="Språk" Margin="5,5,5,10" >

            <Grid Margin="0,10,0,0">
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="Auto" />
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto" />
                    <ColumnDefinition Width="Auto" />
                    <ColumnDefinition Width="Auto" />
                </Grid.ColumnDefinitions>

                <Label Content="Ceremonispråk:" Grid.Row="0" Grid.Column="0" />
                
                <ListBox x:Name="CeremonyLanguagesRadioButtonList" Grid.Row="0" Grid.Column="1" Grid.ColumnSpan="2" 
                          Style="{DynamicResource HorizontalRadioButtonList}" ItemsSource="{Binding CeremonyLanguages}" />

                <Label Content="Annat språk:" Grid.Row="1" Grid.Column="0" />
                
                <TextBox Grid.Row="1" Grid.Column="1" x:Name="OtherLanguageTextBox" MinWidth="120" Margin="0,2,0,0"
                         Text="{Binding OtherLanguage, UpdateSourceTrigger=Explicit, Mode=TwoWay}" />
                
                <CheckBox x:Name="InterpreterCheckBox" Grid.Row="1" Grid.Column="2" Content="Tolk" Margin="5,0,0,0" VerticalAlignment="Center"
                          Padding="5,0,0,0" IsChecked="{Binding Interpreter, UpdateSourceTrigger=Explicit}" />

                <Label Content="Vigselbevis:" Grid.Row="2" Grid.Column="0" />

                <ComboBox x:Name="CertificateLanguagesComboBox" Grid.Row="2" Grid.Column="1" Grid.ColumnSpan="2" Margin="0,2,0,0"
                          ItemsSource="{Binding CertificateLanguages}" 
                          SelectedItem="{Binding CertificateLanguage, UpdateSourceTrigger=Explicit}">
                    <ComboBox.ItemTemplate>
                        <DataTemplate>
                            <TextBlock Text="{Binding Name}" />
                        </DataTemplate>
                    </ComboBox.ItemTemplate>
                </ComboBox>

            </Grid>
        </GroupBox>

        <!--Förrättare-->
        <GroupBox Grid.Row="0" Grid.Column="1" Header="Förrättare" Margin="5,5,5,10">

            <Grid Margin="0,10,0,0">
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="Auto" />
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto" />
                    <ColumnDefinition Width="Auto" />
                </Grid.ColumnDefinitions>

                <Label Content="Förnamn:" Grid.Row="0" Grid.Column="0" />
                <Label Content="Efternamn:" Grid.Row="1" Grid.Column="0" />

                <TextBox Grid.Row="0" Grid.Column="1" x:Name="MinisterFirstNameTextBox" MinWidth="150" IsEnabled="False"
                         Text="{Binding MinisterFirstName, UpdateSourceTrigger=Explicit, Mode=TwoWay}" Margin="0,0,0,2" />

                <TextBox Grid.Row="1" Grid.Column="1" x:Name="MinisterLastNameTextBox" MinWidth="150" IsEnabled="False"
                         Text="{Binding MinisterLastName, UpdateSourceTrigger=Explicit, Mode=TwoWay}" />

            </Grid>
        </GroupBox>

        <!--Övrigt-->
        <GroupBox Grid.Row="1" Grid.Column="1" Header="Övrigt" Margin="5,5,5,10" ToolTip="Skrivs ut på förteckningen">

            <Grid Margin="0,10,0,0">
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="Auto" />
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto" />
                    <ColumnDefinition Width="Auto" />
                </Grid.ColumnDefinitions>

                <Label Content="Särskilda behov:" Grid.Row="0" Grid.Column="0" />
                <Label Content="Notering:" Grid.Row="1" Grid.Column="0" VerticalAlignment="Top" Margin="0,0,0,0"/>

                <ListView Grid.Row="0" Grid.Column="1" x:Name="SpecialNeedsRadioButtonList" 
                          SelectionMode="Multiple"
                          Style="{DynamicResource HorizontalCheckboxList}" 
                          ItemsSource="{Binding CeremonySpecialNeeds}"
                          SelectionChanged="SpecialNeedsRadioButtonList_SelectionChanged"/>

                <TextBox Grid.Row="1" Grid.Column="1" Margin="5,5,0,0" TextWrapping="Wrap" x:Name="NoteTextBox"
                         Width="250" AcceptsReturn="True" MinHeight="70" MaxHeight="75" MinLines="2" MaxLines="4" MaxLength="500"
                         Text="{Binding Note, UpdateSourceTrigger=Explicit, Mode=TwoWay}" />
            </Grid>

         </GroupBox>

        <!--Command buttons-->
        <StackPanel Grid.Column="1" Grid.Row="2" Orientation="Horizontal" HorizontalAlignment="Right" Margin="0,0,10,0">
            <Button x:Name="CancelButton" Content="Ångra" Click="CancelButton_Click" Margin="0,0,5,0" IsEnabled="False" />
            <Button x:Name="SaveButton" Content="Spara" Click="SaveButton_Click" Command="{Binding SaveCommand}" IsEnabled="False" />
        </StackPanel>
        
        <!--Free space-->
        <Grid Grid.Row="5" Grid.ColumnSpan="2">

        </Grid>    
    </Grid>

</UserControl>
